﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PSI.Services;
using PSI.Helper;

namespace PSI.Controllers
{
    public class BaseCodeRuntimeController : PSIController
    {
        //
        // GET: /BaseCodeRuntime/

        public ActionResult Index()
        {
            var fid = Request["fid"];

            if (fid != null && fid.Length > 0) {

                var FID = new FIdService().GetSingbyFID(fid);

                return View(FID);
            }
            
            return View();
        }


        [HttpPost]
        public ActionResult GetColumnsItem(string basecodeid) {

            var result = new BaseCodeRuntimeService().GetColnumsInfo(basecodeid);

            return Json(result);           
        }

        [HttpPost]
        public ActionResult GetInfoItem(string basecodeid) {

            var result = new BaseCodeRuntimeService().GetBaseCodeInfo(basecodeid);

            return Json(new { Data=result });
        }

        [HttpPost]
        public ActionResult DeleteInfo(string basecodeid, string infoid) {

            var result=new BaseCodeRuntimeService().DeleteBaseCodeInfo(basecodeid,infoid);

            return Json(result);
        
        }

        [HttpPost]
        public ActionResult AddBCInfo() {

            var info = Request.Form;

            var result = new BaseCodeRuntimeService().AddbcInfo(info);

            return Json(result);
        }

    }
}
